in lua, the list must end with {NULL, NULL. LuaL_newlib creates a table in the stack and registers the C function in the mylib array into this table. Luaopen_mylib loads the functions in this table into the lua environment.
First, compile the C code into a dynamic link library,
Gcc-shared-fPIC-o mylib. so mylib. c-llua-lm-ldl
In the lua code, require searches fo
remarksIs this the end of it? Of course not, next, you need to use the LUA interpreter to help you understand and practice. This article just helps you get a general idea of Lua's syntax. If you have a programming base, you will soon be getting started with Lua.Like the C language, LUA provides quite a number of standard functions to enhance the functionality of
Date: 2014.8.7
Part IV the C API
27 Calling C from Lua
Here, Lua calls the C function, which does not mean that Lua can call any C function. Like calling the Lua function by C, the following rules must be followed: Passing parameters to obtain the result. In addition, to call the C function,
amount of memory used by Lua (decimal part of kilobytes. Lua_gcsetpause ("setpause"): sets the pause parameter of the recycler. The unit of percentage is used. When the set data value is 100, 1 (100%) is set ). used to control the interval between two recycling cycles. Lua_gcsetstepmul ("setstepmul"): sets the step multiplier parameter of the recycler. It is also the unit of percentage. Controls the amount of memory to be recycled for each reclaim op
Today, our first book, based on XCode6.1 's latest version of Swift Grammar, has a lovely name: "The old code says programming to the Swift River," and a beautiful cover:This book is not a pedigree, it's just a five-bit it old yard kid.One day in May, we have a few old yards to the software park at the door of the small noodle restaurant to eat, chat suddenly on
The difference between the dot (.) and colon (:) In the lua programming script is as follows:
When you declare a function in lua, you can use either of the following methods:
1.
Function ClassA. show ()
Print ("test1 ")
End
2.
Function ClassA: show ()
Print ("test2 ")
EndSo what are the differences between the two methods? Simple
When defining: Clas
In view of my previous comments on Lua, I need to revise my remarks here: the most mature client development portfolio in the game development language work: C/D, lua/c#, assembly assembly. The C + + series is used to complete the game engine framework, assembly for optimization, and LUA for game logic. Meet the needs of performance, readability, and variability
Network ' s JavaScript guideEssential Javascript jQuery Design Patterns for BeginnersLatexThe Introduction to LATEX (perfect for beginners is especially suitable for beginners)LinuxAdvanced Linux ProgrammingLispA Gentle Introduction to Symbolic computation (PDF)Practical Common LispOn LispANSI Common LispCommon Lisp the Language, 2nd EditionSuccessful LispLet over lambda–50 years of LispNatural Language processing in LispLuaProgramming in Lua (for V
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.